package com.jintoufs.service.shop.impl;

import com.jintoufs.dao.shop.ShopManagerMapper;
import com.jintoufs.domain.shop.ShopManager;
import com.jintoufs.service.shop.ShopManagerService;
import com.jintoufs.util.valid.ValidUtil;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Service
public class ShopManagerServiceImpl implements ShopManagerService {
    @Resource
    private ShopManagerMapper shopManagerMapper;
    @Override
    public ShopManager save(ShopManager shop, String id) {
        if (!ValidUtil.isEmpty(id)){
            shop.setId(id);
            shopManagerMapper.insert(shop);
        }else{
            shopManagerMapper.updateByPrimaryKey(shop);
        }
        return shop;
    }

    @Override
    public List<Map<String, Object>> queryByParam(Map<String, Object> param) {
        return shopManagerMapper.queryByParam(param);
    }
}
